
#ifndef __NETWORK_DB_FROM_XML_H
#define __NETWORK_DB_FROM_XML_H

#include "../aprtools/APRAutoMemoryPool.h"
#include "../aprtools/APRDOMDocument.h"
#include "../db/NetworkDB.h"

/** Takes information for adding to the network database from an XML file. */
class NetworkDBFromXML
{
   public:
      NetworkDBFromXML(const char *ifilename, apr_pool_t *imp);
      ~NetworkDBFromXML();
      int mergeXMLWithNetworkDB(NetworkDB *netdb);
   private:
      int parseTree(apr_xml_elem *elem, NetworkDB *netdb, const char *active_cluster);
      const char *parseCluster(apr_xml_elem *elem, NetworkDB *netdb);
      int parseHost(apr_xml_elem *elem, NetworkDB *netdb, const char *clusterid);
      int parseAlias(apr_xml_elem *elem, NetworkDB *netdb);
      /** Pointer to the DOM document containing the XML. */
      APRDOMDocument *netxml;
      /** Auto memory pool that is created and destroyed with the class. */
      APRAutoMemoryPool pool;
};

#endif
